package ms.maplestory.boot.service.jobs;

import lombok.extern.slf4j.Slf4j;
import ms.maplestory.boot.client.character.Char;
import ms.maplestory.boot.client.character.CharStat;
import ms.maplestory.boot.repository.CharStatRepository;
import ms.maplestory.boot.repository.SkillRepository;
import ms.maplestory.boot.service.InventoryService;
import ms.maplestory.boot.service.helpers.CharHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public abstract class JobService implements IJobService {

    @Autowired
    protected CharStatRepository charStatRepository;
    @Autowired
    protected InventoryService inventoryService;
    @Autowired
    protected SkillRepository skillRepository;

    @Override
    public void init(Char chr) {

    }

    @Override
    public void initCharCreationStats(Char chr) {
        CharStat charStat = chr.getStat();
        charStat.setLevel(1);
        charStat.setStr(12);
        charStat.setDex(5);
        charStat.setInt_(4);
        charStat.setLuk(4);
        charStat.setMaxHp(50);
        charStat.setHp(50);
        charStat.setMaxMp(50);
        charStat.setMp(50);
        charStat.setPosMap(100000000);
        charStatRepository.save(charStat);
        inventoryService.saveAll(CharHelper.getInventories(chr));
    }

}
